<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Document</title>
  </head>
  <body>
    <script>
      var arr = ['red', 'green', 'blue', 'pink', 'blue'];
      console.log(arr.indexOf('blue'));		  // 输出结果：2
      console.log(arr.lastIndexOf('blue'));	// 输出结果：4
    </script>
  </body>
</html>